<%@page import="com.surelution.projects.crm.GasType"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="layout" content="main"/>
<g:set var="entityName" value="${message(code: 'gasList.label', default: 'gasList')}" />
<g:javascript library="jquery"/>
<resource:dateChooser />
<link rel="stylesheet" href="${resource(dir:'css',file:'defaultTheme.css')}" />
<script type="text/javascript" src="${resource(dir:'js/jquery',file:'jquery.fixedheadertable.min.js')}"></script>
<script type="text/javascript" src="${resource(dir:'js/jquery',file:'jquery.printElement.min.js')}"></script>
<script type="text/javascript" src="${resource(dir:'js/datechooser',file:'datechooser.js')}"></script>
<title><g:message code="default.button.comparePrice.label"  /></title>
	<script type="text/javascript">
		$(document).ready(function() {
		   $("#simplePrint").click(function() {
		       printElem({leaveOpen: true, printMode: 'popup', overrideElementCSS: ["${resource(dir:'plugins/richui-0.8/css',file:'calendarmonthview.css')}","${resource(dir:'css',file:'main.css')}"]});
		   });
		   $('#myTable01').fixedHeaderTable({ footer: false, cloneHeadToFoot: false, autoShow: true });
		});
		function printElem(options){
		    $('#monthReport').printElement(options);
		};
		
	</script>
</head>

<body>
  <div class="body">
          <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
          </div>
          <div>
			<p style="font-size:16px;color:#000;margin:10px 0;">竞争对手油价对比</p>
        	<g:form action="comparePrice">
    			<g:submitButton name="查询" style="margin-right:5px;"/><input type="button" value="打印报表" id="simplePrint" />
    			<span class="menuButton"><g:actionSubmit value="${message(code: 'default.button.export.label', default: 'Export')}" action="comparePriceExport"/></span><br>
			</g:form>
			<g:if test="${flash.message}">
            	<div class="message">${flash.message}</div>
            </g:if>
        </div>
        
        <div id="monthReport" style="height:620px;">
			<p style="font-size:16px;color:#000;margin:10px 0;">报表时间： ${startDay.format("yyyy.MM.dd")}</p>
        		<table id="myTable01">
        			<thead>
        			<tr>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;" colspan="5">中石油信息采集点</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;" colspan="6">竞争对手</td>
        			</tr>
	        		<tr>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:50px;">片区</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:100px;">本站加油站名</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:80px;">93#汽(元)</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:80px;">97#汽(元)</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:80px;">0#柴(元)</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:80px;">性质</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:180px;">加油站名称</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:80px;">93#汽(元)</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:80px;">97#汽(元)</td>
	        			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;width:80px;">0#柴(元)</td>
	          			<td style="text-align: center;vertical-align: middle;background:#75746a;color:#fff;">其他促销</td>
	    			</tr>
	    			</thead>
	    			<tbody>
	    			
    				<g:each in="${result}" var="r" status="i">
					<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
						<% def stationId = r.get("station").id %>
    					<td style="text-align:center;">${r.get("area")}</td>
    					<td style="text-align:center;">${r.get("ownStation")}</td>
    					<td style="text-align:center;">${r.get("93#")}</td>
    					<td style="text-align:center;">${r.get("97#")}</td>
    					<td style="text-align:center;">${r.get("0#")}</td>
    					<td style="text-align:center;">${r.get("type")}</td>
    					<td style="text-align:center;"><g:link action="show" id="${stationId}">${r.get("stationName")}</g:link></td>
    					<td style="text-align:center;">${r.get("93#1")}</td>
    					<td style="text-align:center;">${r.get("97#1")}</td>
    					<td style="text-align:center;">${r.get("0#1")}</td>
    					<td style="text-align:center;">${r.get("promoting")}</td>
    				</tr>
    				</g:each>
    				</tbody>
          	</table>
        </div>

  </div>
</body>
</html>